@extends('admin.layout')

@section('content')

    <div class="console-content">
        <div class="page-header">
            <h2 id="nav">
                产品列表
                <div class="pull-right">
                    <button onclick="location.href='{{admin_url('trade/createcate')}}'" class="btn btn-success" data-toggle="tooltip" data-placement="top" data-original-title="新增分类">新增分类</button>
                </div>
            </h2>
        </div>
        <div class="well bs-component">
            <table class="table table-wechat">
                <thead class="thead">
                <tr>
                    <td>分类名称</td>
                    <td>最后更新时间</td>
                    <td>操作</td>
                </tr>
                </thead>
                <tbody class="tbody">
                @if($categories->count())
                    @foreach($categories as $category)
                        <tr>
                            <td>{{ $category->cate_name }}</td>
                            <td>{{$category->created_at->format('Y-m-d H:i:s')}}</td>
                            <td>
                                <a href="{{ admin_url('trade/updatecate/'.$category->id)}}" class="btn btn-default btn-xs">编辑</a>
                                <a href="{{ admin_url('trade/destroycate/'.$category->
                            id) }}" class="btn btn-danger btn-xs" onclick="return confirm('删除后无法恢复,确定要删除吗')">删除
                                </a>
                            </td>
                        </tr>
                    @endforeach
                @else
                    <tr>
                        <td colspan="5">
                        <span class="empty_tips">
                            暂无产品，点击
                            <a href="{{ admin_url('trade/createcate') }}" >添加产品</a>
                        </span>
                        </td>
                    </tr>
                @endif
                </tbody>
            </table>
        </div>
    </div>

@stop